package com.tiancheng.trade.payment.mapper;

import com.tiancheng.trade.payment.model.CouponSettleDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Ø
 *
 * @author likailun
 * @date 2021-12-15 21:00
 */
@Repository
public interface CouponSettleDetailMapper extends TYBaseMapper<CouponSettleDetail> {

    void saveBatch(@Param("list") List<CouponSettleDetail> list);

    void updateBatch(@Param("list") List<CouponSettleDetail> list);

    void updatePayFlowByDetailIds(@Param("list") List<String> detailSettleIds,@Param("status") String status);

    void updateRefundFlowByDetailIds(@Param("list") List<String> detailSettleIds,@Param("status") String status);

    @Update("update coupon_settle_detail set allow_return_amount = allow_return_amount - #{allowReturnAmount} where settle_id = #{settleId}")
    void updateAllowReturnAmount(@Param("settleId")String settleId, @Param("allowReturnAmount")int allowReturnAmount);
}
